package com.hygj.service.impl;

import com.hygj.baseUtil.BaseDao;
import com.hygj.baseUtil.BaseServiceImpl;
import com.hygj.pojo.User;
import com.hygj.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author hygl
 */
@Service("userService")
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {

	@Resource
    UserService userService;
	
	
	@Resource(name = "userDao")
	@Override
	public void setDao(BaseDao<User> dao) {
		// TODO Auto-generated method stub
		super.setDao(dao);
	}

	@Override
	public boolean findUserByLoginName(String username) {
		System.out.println("开始--");
		Map<String, Object> params = new HashMap<>();
		params.put("username", username);
		return userService.listAll("find", params).isEmpty();
	}




	@Override
	public void delete(Integer[] ids) {
		Map<String, Object> params = new HashMap<String, Object>();
		if(ids.length > 0){			
			for(Integer id: ids){
				//给userMapper 传id值  通过 params
				params.put("id", id);
				userService.delete("delete",id);
				
			}
			
		}
		
	}

}
